package com.wangyang.stock.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class CreateId {
	private static int count = 100;

	/**
	 * 得到 Id
	 * 
	 * @return
	 */

	public static Long getId() {
		Date date = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHH");// yyyyMMddHHmmssSSS
		StringBuffer sb = new StringBuffer(sdf.format(date));
		// sb.append(System.currentTimeMillis() % 10000000 / 1000000);
		// sb.append(System.currentTimeMillis() % 1000000 / 100000);
		sb.append(System.currentTimeMillis() % 100000 / 10000);
		// sb.append(System.currentTimeMillis() % 10000 / 1000);
		sb.append(System.currentTimeMillis() % 1000 / 100);
		// sb.append(System.currentTimeMillis() % 100 / 10);
		// sb.append(System.currentTimeMillis() % 10);
		// sb.append(System.nanoTime() % 1000000 / 100000);
		// sb.append(System.nanoTime() % 100000 / 10000);
		// sb.append(System.nanoTime() % 10000 / 1000);
		sb.append(count++);
		// System.out.println(sb.toString().length());
		long l = Long.valueOf(sb.toString());
		return l;
	}
}
